package com.baiwei.vpnapi.controller;

import com.baiwei.vpnapi.service.RecommendService;
import com.baiwei.vpnapi.utils.ResultVoUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @program: vpnapi
 * @description:
 * @author: Mr. Stone
 * @create: 2020-09-01 17:18
 **/

@RestController
@RequestMapping("/invite")
public class RecommendController {

    @Autowired
    private RecommendService recService;

    // 获取推荐码
    @GetMapping("/code")
    public Object getInviteCode() {
        return ResultVoUtils.success(recService.getInviteCode());
    }

    // 领取推荐奖励
    @GetMapping("/take/{recId}")
    public Object validInviteTime(@PathVariable Integer recId) {
        return  ResultVoUtils.success(recService.validInviteTime(recId));
    }

    // 推荐列表
    @GetMapping("/list")
    public Object getInvitations() {
        return ResultVoUtils.success(recService.getInvitationList());
    }

    // 获取推荐奖励剩余时间
    @GetMapping("/time")
    public Object getInvitationTime() {
        return ResultVoUtils.success(recService.getInvitationTime());
    }

    // 获取评价奖励
    @GetMapping("/comment")
    public Object takeCommentBonus() {
        return ResultVoUtils.success(recService.takeCommentBonus());
    }

}
